package com.iplant.mes.service.po.exc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.DBJoinMulti;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.general.CalendarTool;
import lombok.extern.slf4j.Slf4j;

import java.util.Calendar;

/**
 * 返工返修 详情 或记录
 */
@Slf4j
@DBBasePO(TableName = "exc_product_repair_item", Schemas = DBSchemas.MES, Name = false, Active = false,
        CheckName = {"Code"}, CodeAuto = true, CodePrefix = "{:TaskCode}-", CodeNum = 4)
public class EXCProductRepairItem extends BasePO {

    @DBCondition
    @DBField
    public int TaskID = 0;

    @DBCondition
    @DBField
    public String TaskCode = "";

    @DBCondition
    @DBField
    public int WorkpieceID = 0;


    @DBCondition
    @DBField
    public String WorkpieceNo = "";

    /**
     * 订单ID
     */
    @DBCondition
    @DBField
    public int OrderID = 0;
    /**
     * 订单号
     */
    @DBCondition
    @DBField
    public String OrderNo = "";

    @DBCondition
    @DBField
    public int ProductID = 0;

    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductNo = "";

    @DBJoin(name = "Name", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductName = "";

    @DBCondition
    @DBField
    public int Type = 0;

    @DBCondition
    @DBField
    public int RoutePartPointID = 0;
    @DBField
    public String RoutePartPointName = "";
    @DBField
    public String RoutePartPointCode = "";
    @DBCondition
    @DBField
    public int RoutePartID = 0;
    @DBField
    public String RoutePartName = "";
    @DBField
    public String RoutePartCode = "";
    @DBCondition
    @DBField
    public int WorkID = 0;

    @DBJoinMulti(Name = "Name", TableName = "mbs_user", Schemas = DBSchemas.Basic, MainTableField =
            "WorkID")
    public String WorkName = "";
    /**
     * 自检时刻
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "StartDate", ParamName2 = "EndDate")
    @DBField
    public Calendar CheckTime = CalendarTool.getDate();

    /**
     * 报工日期
     */
    @DBField
    public Calendar ReportTime = CalendarTool.getDate();

    /**
     * 状态  1执行中 2检验完成合格 3检验完成不合格 4 报工完成
     */
    @DBField
    @DBCondition
    public int Status = 0;


    @JsonProperty("WorkpieceID")
    public int getWorkpieceID() {
        return WorkpieceID;
    }

    public void setWorkpieceID(int workpieceID) {
        WorkpieceID = workpieceID;
    }

    @JsonProperty("WorkpieceNo")
    public String getWorkpieceNo() {
        return WorkpieceNo;
    }

    public void setWorkpieceNo(String workpieceNo) {
        WorkpieceNo = workpieceNo;
    }

    @JsonProperty("TaskID")
    public int getTaskID() {
        return TaskID;
    }

    public void setTaskID(int taskID) {
        TaskID = taskID;
    }

    @JsonProperty("TaskCode")
    public String getTaskCode() {
        return TaskCode;
    }

    public void setTaskCode(String taskCode) {
        TaskCode = taskCode;
    }

    @JsonProperty("OrderID")
    public int getOrderID() {
        return OrderID;
    }

    public void setOrderID(int orderID) {
        OrderID = orderID;
    }

    @JsonProperty("OrderNo")
    public String getOrderNo() {
        return OrderNo;
    }

    public void setOrderNo(String orderNo) {
        OrderNo = orderNo;
    }

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductNo")
    public String getProductNo() {
        return ProductNo;
    }

    public void setProductNo(String productNo) {
        ProductNo = productNo;
    }

    @JsonProperty("ProductName")
    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }

    @JsonProperty("Type")
    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    @JsonProperty("RoutePartPointID")
    public int getRoutePartPointID() {
        return RoutePartPointID;
    }

    public void setRoutePartPointID(int routePartPointID) {
        RoutePartPointID = routePartPointID;
    }

    @JsonProperty("RoutePartPointName")
    public String getRoutePartPointName() {
        return RoutePartPointName;
    }

    public void setRoutePartPointName(String routePartPointName) {
        RoutePartPointName = routePartPointName;
    }

    @JsonProperty("RoutePartPointCode")
    public String getRoutePartPointCode() {
        return RoutePartPointCode;
    }

    public void setRoutePartPointCode(String routePartPointCode) {
        RoutePartPointCode = routePartPointCode;
    }

    @JsonProperty("RoutePartID")
    public int getRoutePartID() {
        return RoutePartID;
    }

    public void setRoutePartID(int routePartID) {
        RoutePartID = routePartID;
    }

    @JsonProperty("RoutePartName")
    public String getRoutePartName() {
        return RoutePartName;
    }

    public void setRoutePartName(String routePartName) {
        RoutePartName = routePartName;
    }

    @JsonProperty("RoutePartCode")
    public String getRoutePartCode() {
        return RoutePartCode;
    }

    public void setRoutePartCode(String routePartCode) {
        RoutePartCode = routePartCode;
    }

    @JsonProperty("WorkID")
    public int getWorkID() {
        return WorkID;
    }

    public void setWorkID(int workID) {
        WorkID = workID;
    }

    @JsonProperty("WorkName")
    public String getWorkName() {
        return WorkName;
    }

    public void setWorkName(String workName) {
        WorkName = workName;
    }

    @JsonProperty("CheckTime")
    public Calendar getCheckTime() {
        return CheckTime;
    }

    public void setCheckTime(Calendar checkTime) {
        CheckTime = checkTime;
    }

    @JsonProperty("ReportTime")
    public Calendar getReportTime() {
        return ReportTime;
    }

    public void setReportTime(Calendar reportTime) {
        ReportTime = reportTime;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }
}
